<?php
/**
 * Created by PhpStorm.
 * User: yanghe
 * Date: 2016/4/26
 * Time: 15:13
 */
namespace App\Http\Controllers\User;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Request;
use MyClass\User\UserBase;

class UserController extends Controller
{
    public function login()
    {
        $data=Request::only("user_name","user_password");
        $res=UserBase::login($data);
        if($res)
        {
            session(["user_name" =>$data["user_name"]]);
            return redirect("/main");
        }
        else
        {
            return redirect("/login");
        }

    }
    public function logOut()
    {
        $res=UserBase::logout();
        if($res)
        {
            return redirect("/login");
        }
        else
        {
            echo "失败";
        }
    }
}